//
//  CZEmoticonButton.swift
//  WeiBO28
//
//  Created by 飞奔的羊 on 16/5/21.
//  Copyright © 2016年 itcast. All rights reserved.
//

import UIKit

class CZEmoticonButton: UIButton {
//保存表情模型
	var emoticon: CZEmoticon? {
		didSet{
			guard let etn = emoticon else {
			return
			}
			//r让其显示
			self.hidden = false
			if etn.type == "0" {
				self.setImage(UIImage(named: etn.path!), forState: .Normal)
				self.setTitle(nil, forState: .Normal)
			} else {
				//emoji
				self.setTitle((etn.code! as NSString).emoji(), forState: .Normal)
				self.setImage(nil, forState: .Normal)
			}
		
		}
	}

}
